-
Notifications
You must be signed in to change notification settings - Fork 312
Container hash tags propagation #9282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
… propagation feature flag is enabled
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 13 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.047 s) : 0, 1047328
Total [baseline] (10.651 s) : 0, 10650612
Agent [candidate] (1.055 s) : 0, 1055488
Total [candidate] (10.54 s) : 0, 10539555
section appsec
Agent [baseline] (1.22 s) : 0, 1220175
Total [baseline] (10.732 s) : 0, 10731632
Agent [candidate] (1.224 s) : 0, 1223636
Total [candidate] (10.697 s) : 0, 10696575
section iast
Agent [baseline] (1.179 s) : 0, 1178809
Total [baseline] (10.933 s) : 0, 10932857
Agent [candidate] (1.178 s) : 0, 1177833
Total [candidate] (10.809 s) : 0, 10808976
section profiling
Agent [baseline] (1.203 s) : 0, 1202865
Total [baseline] (10.923 s) : 0, 10923491
Agent [candidate] (1.194 s) : 0, 1194257
Total [candidate] (10.804 s) : 0, 10804171
gantt
title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.459 ms) : 0, 1459
crashtracking [candidate] (1.451 ms) : 0, 1451
BytebuddyAgent [baseline] (732.068 ms) : 0, 732068
BytebuddyAgent [candidate] (738.388 ms) : 0, 738388
GlobalTracer [baseline] (242.391 ms) : 0, 242391
GlobalTracer [candidate] (243.461 ms) : 0, 243461
AppSec [baseline] (30.076 ms) : 0, 30076
AppSec [candidate] (30.357 ms) : 0, 30357
Debugger [baseline] (6.05 ms) : 0, 6050
Debugger [candidate] (6.074 ms) : 0, 6074
Remote Config [baseline] (666.324 µs) : 0, 666
Remote Config [candidate] (674.548 µs) : 0, 675
Telemetry [baseline] (13.641 ms) : 0, 13641
Telemetry [candidate] (13.909 ms) : 0, 13909
section appsec
crashtracking [baseline] (1.439 ms) : 0, 1439
crashtracking [candidate] (1.441 ms) : 0, 1441
BytebuddyAgent [baseline] (753.312 ms) : 0, 753312
BytebuddyAgent [candidate] (755.613 ms) : 0, 755613
GlobalTracer [baseline] (234.899 ms) : 0, 234899
GlobalTracer [candidate] (235.36 ms) : 0, 235360
IAST [baseline] (23.759 ms) : 0, 23759
IAST [candidate] (23.723 ms) : 0, 23723
AppSec [baseline] (169.362 ms) : 0, 169362
AppSec [candidate] (167.893 ms) : 0, 167893
Debugger [baseline] (6.566 ms) : 0, 6566
Debugger [candidate] (9.537 ms) : 0, 9537
Remote Config [baseline] (645.682 µs) : 0, 646
Remote Config [candidate] (622.138 µs) : 0, 622
Telemetry [baseline] (9.173 ms) : 0, 9173
Telemetry [candidate] (8.437 ms) : 0, 8437
section iast
crashtracking [baseline] (1.448 ms) : 0, 1448
crashtracking [candidate] (1.442 ms) : 0, 1442
BytebuddyAgent [baseline] (851.194 ms) : 0, 851194
BytebuddyAgent [candidate] (849.338 ms) : 0, 849338
GlobalTracer [baseline] (232.999 ms) : 0, 232999
GlobalTracer [candidate] (235.716 ms) : 0, 235716
IAST [baseline] (30.937 ms) : 0, 30937
IAST [candidate] (28.322 ms) : 0, 28322
AppSec [baseline] (26.513 ms) : 0, 26513
AppSec [candidate] (26.68 ms) : 0, 26680
Debugger [baseline] (5.769 ms) : 0, 5769
Debugger [candidate] (6.507 ms) : 0, 6507
Remote Config [baseline] (610.34 µs) : 0, 610
Remote Config [candidate] (597.628 µs) : 0, 598
Telemetry [baseline] (8.327 ms) : 0, 8327
Telemetry [candidate] (8.207 ms) : 0, 8207
section profiling
crashtracking [baseline] (1.442 ms) : 0, 1442
crashtracking [candidate] (1.41 ms) : 0, 1410
BytebuddyAgent [baseline] (767.012 ms) : 0, 767012
BytebuddyAgent [candidate] (761.923 ms) : 0, 761923
GlobalTracer [baseline] (223.138 ms) : 0, 223138
GlobalTracer [candidate] (220.592 ms) : 0, 220592
AppSec [baseline] (30.214 ms) : 0, 30214
AppSec [candidate] (30.077 ms) : 0, 30077
Debugger [baseline] (6.322 ms) : 0, 6322
Debugger [candidate] (6.24 ms) : 0, 6240
Remote Config [baseline] (717.958 µs) : 0, 718
Remote Config [candidate] (702.949 µs) : 0, 703
Telemetry [baseline] (15.483 ms) : 0, 15483
Telemetry [candidate] (16.077 ms) : 0, 16077
ProfilingAgent [baseline] (108.771 ms) : 0, 108771
ProfilingAgent [candidate] (107.672 ms) : 0, 107672
Profiling [baseline] (109.414 ms) : 0, 109414
Profiling [candidate] (108.328 ms) : 0, 108328
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.048 s) : 0, 1047693
Total [baseline] (8.605 s) : 0, 8605271
Agent [candidate] (1.047 s) : 0, 1047195
Total [candidate] (8.54 s) : 0, 8539803
section iast
Agent [baseline] (1.178 s) : 0, 1177877
Total [baseline] (9.293 s) : 0, 9293045
Agent [candidate] (1.186 s) : 0, 1185747
Total [candidate] (9.279 s) : 0, 9278663
gantt
title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.455 ms) : 0, 1455
crashtracking [candidate] (1.453 ms) : 0, 1453
BytebuddyAgent [baseline] (734.138 ms) : 0, 734138
BytebuddyAgent [candidate] (733.106 ms) : 0, 733106
GlobalTracer [baseline] (242.005 ms) : 0, 242005
GlobalTracer [candidate] (241.873 ms) : 0, 241873
AppSec [baseline] (30.244 ms) : 0, 30244
AppSec [candidate] (30.146 ms) : 0, 30146
Debugger [baseline] (6.029 ms) : 0, 6029
Debugger [candidate] (6.054 ms) : 0, 6054
Remote Config [baseline] (670.464 µs) : 0, 670
Remote Config [candidate] (669.563 µs) : 0, 670
Telemetry [baseline] (12.135 ms) : 0, 12135
Telemetry [candidate] (12.932 ms) : 0, 12932
section iast
crashtracking [baseline] (1.452 ms) : 0, 1452
crashtracking [candidate] (1.449 ms) : 0, 1449
BytebuddyAgent [baseline] (849.671 ms) : 0, 849671
BytebuddyAgent [candidate] (857.218 ms) : 0, 857218
GlobalTracer [baseline] (232.969 ms) : 0, 232969
GlobalTracer [candidate] (233.209 ms) : 0, 233209
AppSec [baseline] (26.086 ms) : 0, 26086
AppSec [candidate] (27.652 ms) : 0, 27652
Debugger [baseline] (8.397 ms) : 0, 8397
Debugger [candidate] (6.615 ms) : 0, 6615
Remote Config [baseline] (596.194 µs) : 0, 596
Remote Config [candidate] (608.969 µs) : 0, 609
Telemetry [baseline] (8.326 ms) : 0, 8326
Telemetry [candidate] (8.393 ms) : 0, 8393
IAST [baseline] (29.4 ms) : 0, 29400
IAST [candidate] (29.523 ms) : 0, 29523
LoadParameters
See matching parameters
SummaryFound 7 performance improvements and 0 performance regressions! Performance is the same for 5 metrics, 12 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section baseline
no_agent (4.367 ms) : 4318, 4416
. : milestone, 4367,
iast (9.645 ms) : 9483, 9807
. : milestone, 9645,
iast_FULL (13.795 ms) : 13519, 14071
. : milestone, 13795,
iast_GLOBAL (10.576 ms) : 10389, 10764
. : milestone, 10576,
profiling (8.381 ms) : 8250, 8512
. : milestone, 8381,
tracing (7.543 ms) : 7437, 7650
. : milestone, 7543,
section candidate
no_agent (4.237 ms) : 4186, 4288
. : milestone, 4237,
iast (9.174 ms) : 9017, 9332
. : milestone, 9174,
iast_FULL (13.267 ms) : 13008, 13526
. : milestone, 13267,
iast_GLOBAL (9.348 ms) : 9190, 9505
. : milestone, 9348,
profiling (7.816 ms) : 7692, 7939
. : milestone, 7816,
tracing (7.245 ms) : 7143, 7346
. : milestone, 7245,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section baseline
no_agent (37.261 ms) : 36967, 37556
. : milestone, 37261,
appsec (48.757 ms) : 48306, 49208
. : milestone, 48757,
code_origins (44.92 ms) : 44548, 45292
. : milestone, 44920,
iast (43.941 ms) : 43567, 44314
. : milestone, 43941,
profiling (48.473 ms) : 47978, 48967
. : milestone, 48473,
tracing (44.606 ms) : 44219, 44993
. : milestone, 44606,
section candidate
no_agent (35.734 ms) : 35456, 36013
. : milestone, 35734,
appsec (46.467 ms) : 46063, 46871
. : milestone, 46467,
code_origins (44.231 ms) : 43860, 44602
. : milestone, 44231,
iast (43.231 ms) : 42853, 43609
. : milestone, 43231,
profiling (48.109 ms) : 47650, 48568
. : milestone, 48109,
tracing (42.089 ms) : 41733, 42444
. : milestone, 42089,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 2 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section baseline
no_agent (15.502 s) : 15502000, 15502000
. : milestone, 15502000,
appsec (15.079 s) : 15079000, 15079000
. : milestone, 15079000,
iast (18.783 s) : 18783000, 18783000
. : milestone, 18783000,
iast_GLOBAL (18.149 s) : 18149000, 18149000
. : milestone, 18149000,
profiling (15.18 s) : 15180000, 15180000
. : milestone, 15180000,
tracing (14.988 s) : 14988000, 14988000
. : milestone, 14988000,
section candidate
no_agent (15.396 s) : 15396000, 15396000
. : milestone, 15396000,
appsec (14.613 s) : 14613000, 14613000
. : milestone, 14613000,
iast (18.975 s) : 18975000, 18975000
. : milestone, 18975000,
iast_GLOBAL (17.915 s) : 17915000, 17915000
. : milestone, 17915000,
profiling (15.23 s) : 15230000, 15230000
. : milestone, 15230000,
tracing (15.081 s) : 15081000, 15081000
. : milestone, 15081000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~f9bf0459de, baseline=1.53.0-SNAPSHOT~e125ff7b82
dateFormat X
axisFormat %s
section baseline
no_agent (1.484 ms) : 1472, 1495
. : milestone, 1484,
appsec (3.677 ms) : 3461, 3894
. : milestone, 3677,
iast (2.207 ms) : 2144, 2270
. : milestone, 2207,
iast_GLOBAL (2.252 ms) : 2189, 2315
. : milestone, 2252,
profiling (2.486 ms) : 2271, 2701
. : milestone, 2486,
tracing (2.017 ms) : 1968, 2065
. : milestone, 2017,
section candidate
no_agent (1.48 ms) : 1468, 1491
. : milestone, 1480,
appsec (3.652 ms) : 3436, 3868
. : milestone, 3652,
iast (2.201 ms) : 2139, 2263
. : milestone, 2201,
iast_GLOBAL (2.256 ms) : 2193, 2319
. : milestone, 2256,
profiling (2.045 ms) : 1995, 2095
. : milestone, 2045,
tracing (2.015 ms) : 1967, 2063
. : milestone, 2015,
|
Extract getBaseHash to be available for SQLCommenter TBD: fix SQLCommenterTest TBD: add DB_DBM_INJECT_SERVICE_HASH_ENABLED
builder.append(processTags); | ||
} | ||
return FNV64Hash.generateHash(builder.toString(), FNV64Hash.Version.v1); | ||
return ServiceHash.getBaseHash(wellKnownTags, ContainerInfo.get().getContainerTagsHash()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this into the ServiceHash class so that it is available in the DBM instrumentation.
} | ||
if (processTags != null) { | ||
builder.append(processTags); | ||
if (containerTagsHash != null && !containerTagsHash.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Populate the base hash with the container tag hash if the process tag propagation feature flag is.
@@ -241,6 +250,8 @@ protected static boolean toComment( | |||
if (injectTrace) { | |||
append(sb, TRACEPARENT, traceparent, sb.length() > emptySize); | |||
} | |||
// TODO only if DB_DBM_INJECT_SERVICE_HASH_ENABLED | |||
append(sb, DD_SERVICE_HASH, serviceHash, sb.length() > emptySize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inject the base hash into the SQL comment when the service mode is enabled.
Code coverage: total 57.31%, base diff -0.01%, patch 60.00% (view details) This comment will be updated automatically if new data arrives.🔗 Commit SHA: f9bf045 | Docs | Was this helpful? Give us feedback! |
Clean up hasDDComment.
if (sql == null || sql.isEmpty()) { | ||
return sql; | ||
} | ||
if (hasDDComment(sql, appendComment)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this check to after the appendComment decision is made. Otherwise, it won't work when preferAppend differs from appendComment. This can result in the comment being added twice. Tests were added to ensure this behavior is confirmed.
if (log.isDebugEnabled()) { | ||
log.debug("exception thrown while encoding sql comment %s", e); | ||
} | ||
String encodedValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the encoding first to handle a possible encoding exception properly; otherwise, it will inject a key with an unclosed quote.
if (firstWord.equalsIgnoreCase("call")) { | ||
appendComment = true; | ||
} | ||
|
||
// Append the comment in the case of a pg_hint_plan extension | ||
if (dbType.startsWith("postgres") && containsPgHint(sql)) { | ||
if (dbType.startsWith("postgres") && sql.contains("/*+")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the bug to ensure the hint is detected at the beginning. The original check was sql.indexOf("/*+") > 0
. Remove containsPgHint for simplicity. Tests were added to ensure this behavior is confirmed.
if ((!(sql.endsWith(CLOSE_COMMENT)) && appendComment) | ||
|| ((!(sql.startsWith(OPEN_COMMENT))) && !appendComment)) { | ||
return false; | ||
} | ||
// else check to see if it's a DBM trace sql comment | ||
int startIdx = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the magic constant 2
.
} | ||
int startComment = appendComment ? startIdx : sql.length(); | ||
boolean found = false; | ||
if (startComment > 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is useless because it's never true.
What Does This Do
getBaseHash
to make it visible in the DBMhashOfKnownTags
initialized once, and may not have ContainerTagsHash included, since it’s received from the Agent as a response header.It has to be updated every time ContainerTagsHash has been obtained.
SQLCommenter
and remove unnecessary code.Motivation
Backpropagation of container tags. The agent calculates the hash, which is then injected into DBM queries and the DSM pathway context.
Additional Notes
The agent sends the containerTagsHash in the response header. The Java Tracer stores it in the ContainerInfo.
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: AIDM-700